﻿//=====================================================================================================
// LocalizationLibrary
// The Localization Library is a collection of reusable software components that provide 
// support for localization. This library enables you to localize WPF, Silverlight and WP7 applications.
// (http://localizationlibrary.codeplex.com)
//=====================================================================================================
// Author: Nicola Gallo (Website: www.nicola.gallo.name, Email: nicolagmt@hotmail.it) 
//=====================================================================================================

namespace ReflectionStudio.LocalizationLibrary.Messaging
{
    //.NET References
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Implements a localization model message.
    /// </summary>
    internal class LocalizationModelMessage : IMessage
    {
        //Constructors

        /// <summary>
        /// Create a new instance of <see cref="LocalizationModelMessage"/>
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="operation">Describes the operation.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown whether <paramref name="instance"/> parameter is null.
        /// </exception>
        public LocalizationModelMessage(object instance, Operation operation)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance shouldn't be null.");
            }
            this.Instance = instance;
            this.Operation = operation;
        }

        //Properties

        /// <summary>
        /// Gets the instance.
        /// </summary>
        public Object Instance { get; private set; }

        /// <summary>
        /// Gets the operation.
        /// </summary>
        public Operation Operation { get; private set; }

        //Methods

        /// <summary>
        /// Gets the message.
        /// </summary>
        /// <returns></returns>
        public string GetMessage()
        {
            return String.Format("Instance:{0} Operation:{1}", this.Instance.GetType().FullName, this.Operation.ToString());
        }
    }
}